<?php


namespace App\Services;


use App\Constants\IntegralLogTypeConstant;
use App\Constants\MemberTaskConstant;
use App\Exceptions\BusinessException;

class AdvVideoCallbackService
{
    public function handle(int $memberId, string $advId, string $type, string $miniType): ?array
    {
        switch ($type) {
            case IntegralLogTypeConstant::TYPE_BY_SIGN_VIDEO:
                $ret = app(SignService::class)->video($memberId, $advId, $miniType);
                break;
            case MemberTaskConstant::SLUG_BY_READ_ADV_VIDEO:
                $ret = app(MemberTaskService::class)->handle($memberId, $type, $advId, $miniType);
                break;
            default:
                throw new BusinessException('type参数错误');
        }

        return $ret;
    }
}
